﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Membership;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using MethodWorx.CMS.Plugins;

namespace MethodWorx.CMS.Linq
{
    [Table(Name="dbo.UserDashboardWidget")]
    public class LinqUserDashboardWidget : UserDashboardWidget
    {
        public LinqUserDashboardWidget(): base()
        {
        }

        public LinqUserDashboardWidget(User user, IPlugin plugin, DashboardWidget dw, int sequence, int columnIndex)
            : base(user, plugin, dw, sequence, columnIndex)
        {
        }
        
        #region Proxy Property For Id
        [Column(UpdateCheck=UpdateCheck.Never, IsPrimaryKey=true)]
        public new Guid Id { get { return base.Id; } set { base.Id = value; } }
        #endregion
        #region Proxy Property For WidgetId
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new Guid WidgetId { get { return base.WidgetId; } set { base.WidgetId = value; } }
        #endregion
        #region Proxy Property For PluginId
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new Guid PluginId { get { return base.PluginId; } set { base.PluginId = value; } }
        #endregion     
        #region Proxy Property For User
        private EntityRef<LinqUser> proxyUser = new EntityRef<LinqUser>();
        
        [Column(UpdateCheck=UpdateCheck.Never)]
        public Guid UserId { get; set; }

        [Association(IsForeignKey = true, Name = "UserDashboardWidgets", OtherKey = "Id", ThisKey = "UserId", Storage = "proxyUser", DeleteOnNull=true)]
        public LinqUser ProxyUser
        {
          get { return this.proxyUser.Entity; }
          set { this.proxyUser.Entity = value; }
        }
        
        public override User User
        {
          get { return this.ProxyUser; }
          set { this.ProxyUser = (LinqUser)value; }
        }
        #endregion
        #region Proxy Property For ColumnIndex
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new int ColumnIndex { get { return base.ColumnIndex; } set { base.ColumnIndex = value; } }
        #endregion
        #region Proxy Property For Sequence
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new int Sequence { get { return base.Sequence; } set { base.Sequence = value; } }
        #endregion
        #region Proxy Property For Height
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new int? Height { get { return base.Height; } set { base.Height = value; } }
        #endregion
      
      
        
    }
}
